import numpy as np
import matplotlib.pyplot as plt

def sigmoid(x):
    return 1 / (1 + np.exp(-x))

def tanh(x):
    return (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))

def ReLU(x):
    return np.maximum(0, x)

def LeakyReLU(x):
    return np.where(x>0,x,0.1*x)
    
def ELU(x):
    return np.where(x>0,x,np.exp(x)-1)

def Swish(x):
    return x*sigmoid(x)

def Mish(x):
    return x*tanh(np.log(1+np.exp(x)))

def softmax(x):
    exps = np.exp(x - np.max(x))
    return exps / np.sum(exps, axis=0)



x = np.linspace(-10,10,400)
y = softmax(x)

function_name = 'softmax'
plt.plot(x,y)
plt.title(function_name+' function')
plt.xlabel('x')
plt.ylabel(f'{function_name}(x)')
plt.grid(True)
plt.savefig(function_name+'.png')
plt.show()